package com.demo.bean9001.controller.columnManagement;


import com.demo.bean9001.service.columnManagement.ColumnManagementService;
import com.demo.common.entity.ColumnManagement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
/**
 * 查询父节点、父类下的子节点
 * 作者：孙佳佳
 * 补充：张佑威
 * 分配任务：张改
 * 插入数据：贾冠博
 */
@RestController
@RequestMapping("ColumnManagement")
public class ColumnManagementController {


    @Autowired
    private ColumnManagementService columnManagementService;
    //    查询所有父节点
    @GetMapping("/getfather")
    public List<ColumnManagement> fatherManagerMent(){
        System.out.println(columnManagementService.fatherAll());
        return columnManagementService.fatherAll();
    }

    //    查询单个类别
    @GetMapping("/getmanagement")
    public ColumnManagement oneManagement(@RequestParam(value = "id",required = true) Integer id){
        return columnManagementService.oneManagement(id);
    }

    //    查询单个类别下所有子类
    @GetMapping("/gettype")
    public List<ColumnManagement> mangerMentMap(@RequestParam(value = "id",required = true) String id){
        System.out.println(columnManagementService.typeAll(id));
        return columnManagementService.typeAll(id) ;

    }

}
